﻿define([
    'jquery',
    'ApiClient'
], function ($, ApiClient) {
    var LoginSystem = function (client_id) {
        ApiClient.get('/client/' + client_id, 'NOTROL').then(function (resValue) {
            //console.log(typeof resValue.code);
            if (resValue.code == "200") {
                var date = new Date();
                date.setTime(date.getTime() + resValue.cookietime);//时间为5分钟
                $.cookie("uid", resValue.cookieid, { expires: date, path: '/' });
                //$.cookie(resValue.cookieid,resValue.cookieValue, {expires: date, path: '/'});
                $(window).attr('location', 'index.html');
            } else {
                alert('用户登录错误');
            }
        });
    };
    return {
        LoginSystem: LoginSystem
    }
});